package com.fengzhi.web.action;

import org.apache.log4j.Logger;

import com.fengzhi.web.entity.TbUser;
import com.fengzhi.web.service.ssh.IUserService;
import com.opensymphony.xwork2.ActionSupport;

/**
 * 
 * @Description: TODO(处理操作用户的请求，实现actionsoupport类方便开发，struts2
 *               普通pojo也可以作为action类)
 * @author fyf
 * @date 2016年10月20日 上午9:05:21
 * @version v1.0
 */
@SuppressWarnings("serial")
public class UserAction extends ActionSupport {
	private Logger log = Logger.getLogger(getClass().getName());

	// 通过spring ioc 注入实例化对象
	private IUserService userService;

	@Override
	public String execute() throws Exception {
		log.info("welcome !");
		TbUser user = userService.findUserByUsername("路飞");

		log.info(user != null ? user.getUsername() : "not find user");

		return SUCCESS;
	}

	public IUserService getUserService() {
		return userService;
	}

	public void setUserService(IUserService userService) {
		this.userService = userService;
	}

}
